/**
 * @param {number[]} nums
 * @return {number[]}
 */
 var numberOfPairs = function(nums) {
  let set = new Set()
  let count =0
  for(const num of  nums){
    if(set.has(num)){
      count++
      set.delete(num)
    }else {
      set.add(num)
    }
  }
  return [count,nums.length-count*2]
};